import { service } from '@/axios/index'

export const getProjectInfo = () => {
  return service.get("/ProjectInfo").then(response => {
    return response.data.data;
  });
}

export const getWarningMessageData = (id) => {
  return service.get(`/homepage/warningMessage?deviceFid=${id}`).then(response => {
    return response.data;
  });
}

// 灯具总数（LightOff：熄灯，LightOn：亮灯）
export const getLightingRateData = (id) => {
  return service.get(`/homepage/lightingRate?deviceFid=${id}`).then(response => {
    return response.data;
  });
}

// 网关在线率
export const getDeviceStatusCountData = (id) => {
  return service.get(`/homepage/getDeviceStatusCount?deviceFid=${id}`).then(response => {
    return response.data;
  });
}

// 统计（年、月、改造后电表、电表电量）
export const getQuantityStatistics = (p) => {
  // 电量true，电表false
  const hUrl = '/EnergyStatistic/energyConsData?'
  const pArg = `start=${p.start}&end=${p.end}&projectIds=${p.projectIds}&isRealMeter=${p.isRealMeter}&mode=${p.mode}`
  return service.get(`${hUrl}${pArg}`)
    .then(response => {
      return response.data;
    });
}


//获取统计
export const getAnnualReportData = (params) => {
  // 电量true，电表false
  // EnergyStatistic/energyConsData?start=&end=&projectIds=1673,1672&isRealMeter=false&mode=0
  return service.post("/operationDevice/annualReport", params).then(response => {
    return response.data;
  });
}


//获取统计
export const getEnergyConsData = (params) => {
  return service.get("/EnergyStatistic/energyConsData", { params: params }).then(response => {
    return response.data;
  });
}


//获取统计
export const getRealAnnualReportData = (params) => {
  return service.post("/operationDevice/realAnnualReport", params).then(response => {
    return response.data;
  });
}